home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 9 / CDACTUAL9.iso / share / Dos / VARIOS / pascal / KEYBOARD.SWG / 0001_Re: CapsLock.pas next >
Encoding:
Pascal/Delphi Source File  |  1996-02-21  |  1.3 KB  |  38 lines

  1. {
  2.  JR>> Does anyone have the code (probably ASM) to turn the
  3.  JR>> CapsLock key of _and_ on as well?  Thanks in advance if you
  4.  JR>> can help.
  5.  SS> Procedure TogLed (Lock: Integer);
  6.  
  7. That was a bit long for what you needed to do.  Here's what I got:
  8.  
  9. program capslock;
  10. {This program is design to test the procedure capslock_on.}
  11.  
  12. procedure capslock_on(caps:boolean);
  13. Assembler;
  14.  ASM
  15.  push ds                ; Save the data segment
  16.  mov al, caps           ; Load in the boolean value of caps
  17.  mov bx, 0040h          ; These two lines adjust the data segment
  18.  mov ds, bx             ; to 40h
  19.  mov bx, 17h            ; Point to address 17h
  20.  mov ch, [bx]           ; Get the byte located there
  21.  mov cl, 6h             ; Move 6 into cl
  22.  shl al, cl             ; Shift the bit in al 6 bits to the left
  23.  and ch, 10111111b      ; Reset the 6th bit at our memory location
  24.  or al, ch              ; Stick in the caps bit
  25.  mov [bx], al           ; Put the new byte back
  26.  pop ds                 ; Restore the data segment
  27. end;
  28.  
  29. begin
  30.  capslock_on(true);
  31.  capslock_on(false);
  32. end.
  33.  
  34. You see, there are a host of byte that contain information like whether or not
  35. the capslock is on.  This program edits that information directly, and is
  36. hence a lot smaller and easier to use.  Hope this helps.
  37.  
  38.